using QFramework.Example;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PanelManager : Singleton<PanelManager>
{
    public GameObject UILoginPanel, UIBuyShopPanel, UIBagPanel, UIGamePanel, UILuckyPanel, UIRegisterPanel, UIShopPanel, ChooseRolePanel;
    public List<GameObject> objList;
    // public List<string> PanelNameList=new List<string>() { "UILoginPanel", "UIBagPanel", "UIBuyShopPanel", "UIGamePanel", "UILuckyPanel", "UIRegisterPanel", "UIShopPanel"}
    public void LoadAllPanel()
    {
        UILoginPanel = GameObject.Instantiate(ResourceManager.Instance.LoadResAsset<GameObject>("UILoginPanel", AssetsEnum.UIPrefab), GameObject.Find("Canvas").transform);
        UIGamePanel = GameObject.Instantiate(ResourceManager.Instance.LoadResAsset<GameObject>("UIGamePanel", AssetsEnum.UIPrefab), GameObject.Find("Canvas").transform);
        UIShopPanel = GameObject.Instantiate(ResourceManager.Instance.LoadResAsset<GameObject>("UIShopPanel", AssetsEnum.UIPrefab), GameObject.Find("Canvas").transform);
        UILuckyPanel = GameObject.Instantiate(ResourceManager.Instance.LoadResAsset<GameObject>("UILuckyPanel", AssetsEnum.UIPrefab), UIShopPanel.transform);
        UIRegisterPanel = GameObject.Instantiate(ResourceManager.Instance.LoadResAsset<GameObject>("UIRegisterPanel", AssetsEnum.UIPrefab), GameObject.Find("Canvas").transform);
        UIBuyShopPanel = GameObject.Instantiate(ResourceManager.Instance.LoadResAsset<GameObject>("UIBuyShopPanel", AssetsEnum.UIPrefab), UIShopPanel.transform);
        ChooseRolePanel = GameObject.Instantiate(ResourceManager.Instance.LoadResAsset<GameObject>("ChooseRolePanel", AssetsEnum.UIPrefab), GameObject.Find("Canvas").transform);
        UIBagPanel = GameObject.Instantiate(ResourceManager.Instance.LoadResAsset<GameObject>("UIBagPanel", AssetsEnum.UIPrefab), GameObject.Find("Canvas").transform);
        objList = new List<GameObject>() { UILoginPanel, UIBagPanel, UIGamePanel, UILuckyPanel, UIRegisterPanel, UIShopPanel, ChooseRolePanel, UIBuyShopPanel };
        ClosePanel();
    }
    public void ClosePanel()
    {
        for (int i = 0; i < objList.Count; i++)
        {
            if (i != 0)
            {
                objList[i].SetActive(false);
            }
        }
    }
}
